//
//  LGDiseaseDescriptionCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/11/7.
//

#import "LGDiseaseDescriptionCell.h"

@interface LGDiseaseDescriptionCell()
/**   */
@property (nonatomic , strong)UIView *lineView;
/**   */
@property (nonatomic , strong)UILabel *dateLabel;
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGDiseaseDescriptionCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    self.dateLabel.text = LGNSString(dataDic[@"date"]);
    self.contentLabel.text = LGNSString(dataDic[@"content"]);
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.lineView];
    [self.contentView addSubview:self.dateLabel];
    [self.contentView addSubview:self.baseView];
    [self.baseView addSubview:self.contentLabel];
    [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.lineView.mas_right).offset(viewPix(12));
        make.centerY.equalTo(self.lineView);
    }];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(viewPix(37));
        make.left.equalTo(self.contentView).offset(viewPix(16));
        make.right.equalTo(self.contentView).offset(-viewPix(16));
        make.bottom.equalTo(self.contentView).offset(-viewPix(8));
    }];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.baseView).offset(viewPix(16));
        make.left.equalTo(self.baseView).offset(viewPix(12));
        make.bottom.equalTo(self.baseView).offset(-viewPix(16));
        make.right.equalTo(self.baseView).offset(-viewPix(6));
    }];
}
-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(viewPix(16), viewPix(15), 4, viewPix(14))];
        _lineView.backgroundColor = [UIColor colorWithString:@"#77D4C6"];
        _lineView.cornerRidus = 2;
    }
    return _lineView;
}

-(UILabel *)dateLabel{
    if(!_dateLabel){
        _dateLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _dateLabel;
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B2BDC7" offset:CGSizeMake(0, 2) opacity:0.15 radius:15];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(14) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _contentLabel;
}

@end
